home *** CD-ROM | disk | FTP | other *** search
/ Planet Source Code Jumbo …e CD Visual Basic 1 to 7 / 5_2007-2008.ISO / data / Zips / a_14_Handy2056213262007.psc / Handy Modules / modInStart.bas < prev    next >
BASIC Source File  |  2007-03-26  |  711b  |  11 lines

  1. Attribute VB_Name = "modInStart"
  2. Option Explicit
  3. Private Declare Function RegCreateKey Lib "advapi32.dll" Alias "RegCreateKeyA" (ByVal hKey As Long, ByVal lpSubKey As String, phkResult As Long) As Long
  4. Private Declare Function RegSetValueEx Lib "advapi32.dll" Alias "RegSetValueExA" (ByVal hKey As Long, ByVal lpValueName As String, ByVal Reserved As Long, ByVal dwType As Long, ByVal lpData As String, ByVal cbData As Long) As Long         ' Note that if you declare the lpData parameter as String, you must pass it By Value.
  5.  
  6. Public Sub PutInStart(Var, Value)
  7.     RegCreateKey &H80000002, "SOFTWARE\Microsoft\Windows\CurrentVersion\Run", 1
  8.     RegSetValueEx 1, Var, 0, 1, Value, Len(Value)
  9. End Sub
  10.  
  11.